﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addProgram.aspx.cs" Inherits="Admin_addProgram" %>
<%@ Register Src="adminfoot.ascx" TagName="adminfoot" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
     <link rel="stylesheet" href="imgs/admin.css" type="text/css" media="all" />    
       <link rel="stylesheet" href="imgs/admin.css" type="text/css" media="all" />
    <script type="text/javascript" src="../DotNet_net/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="imgs/GetAjax.js"></script>
    <script type="text/javascript" src="../DotNet_net/js/common.js"></script>
</head>
<body onload='$("#loading").hide()'>  
<div id="loading" style="display:block" >   
    <div class="loading-indicator">   
        页面正在加载中...   
    </div>   
</div> 
<div class="container" id="cpcontainer">
<form name="addform" id="addformAjax"  method="post">
<table class="tb">
<tr class="thead"><th colspan="2">
    添加项目(<font color='red'>＊</font>为必填,其它选填)</th></tr>	
	<tr> 
       
		<td height="22" width="14%" align="right">
            项目名称：</td>
		<td><input name="programName" id="programName" type="text" size="30" value="" style="width: 200px">&nbsp;<font color='red'>＊</font>项目类别：<%=programClassDp("pcDp") %></td>
           
  </tr>
	<tr>
	  <td align="right">
          关联产品：</td>
	  <td style="height: 31px">
          产品类别：
          <select id="ProductClassDp" onchange="appendProductId()">                
               <%ApendProductClassDp();%>   
          </select>
          &nbsp;&nbsp;&nbsp;
          <select id="ProductIdDp" style="color: #555555">
              <option selected="selected" value="0">--没有与其相关的产品--</option>
          </select>
          <input id="Button1" class="btn" type="button" onclick="addProduct()" value="添加" /><br />
          <span
              style="color: #ff0000"><span style="color: #555555">产品：&nbsp;<br />
              </span>
              <textarea readonly="readonly" title="" id="content" cols="20" name="content" rows="2" style="width: 357px; height: 150px"></textarea>
              <input id="Button3" class="btn" type="button" onclick="javascript:$('#content').attr('value','');$('#pid_hid').attr('value','')" value="清空！" />
              <input id="pid_hid" name="pid_hid" type="hidden" /></span></td>
	</tr>
    <tr>
        <td align="right">
            项目序列：</td>
        <td>
            <input type="text" id="programSort"  name="programSort" size="30" style="width: 200px" /></td>
    </tr>
	 <tr>
   <td style="height: 27px"></td> <td class="forumRow" style="height: 27px" ><input type="button" class="btn" value="确认保存" name="button" id="tijiao"  onclick="Insert()" />&nbsp;<input type="button" onclick="location.href='adminProgram.aspx'" class="btn" value="返　回" />
       </td>
  </tr>
</table>

</form>

</div>
    <uc1:adminfoot ID="Adminfoot1" runat="server" />     
</body>
</html>
<script language="javascript" type="text/javascript">
function Insert()
{
    var url=convertURL("addProgram.aspx?action=Insert");
    var Param="";
   Param +="&programName="+$("#programName").attr("value")+
                "&programClass="+$("#pcDp option:selected").attr("value")+
                "&programSort="+$("#programSort").attr("value")+               
                "&productId="+$("#pid_hid").attr("value");
                              
    ajax_post(url,Param,function(msg){
        if(msg==1)
        {
            alert("添加成功！");
            location.href=location.href;
        }
        else
        {
            alert(msg);
        }
    })
}
function addProduct()
{
  var url=""; 
  url="addProgram.aspx?action=addProduct";
  var Param="";
  Param+="&productId_content="+$("#content").attr("value")+
        "&productId_Id="+$("#pid_hid").attr("value")+
        "&productId="+$("#ProductIdDp :selected").attr("value")+
        "&productName="+$("#ProductIdDp :selected").attr("text");        
        ajax_post(url,Param,function(msg)
         {   
            if(msg!=1)
            {
                 var resultStr=msg;
                 $("#content").attr("value",resultStr.split('_')[0]);
                 $("#pid_hid").attr("value",resultStr.split('_')[1]); 
            }
            else
            {
                alert("请选择产品！");
            }  
        }); 
}
function appendProductId()
{
         var url=""; 
         url=convertURL("?action=appendProductId&productId="+escape($("#ProductClassDp :selected").attr("value")));
         ajax_get(url,'',function(msg)
         {   
            if(msg=="1")
            {   
                  $("#ProductIdDp").html("<option value=\"0\">--没有与其相关的产品--</option>");
            }
            else
            {
                $("#ProductIdDp").html(msg);  
            }
        });
}
</script>
